#encoding='gbk'

import random
import unittest
import sys

class TestquenceFunctioons(unittest.TestCase):
    a= 6
    def setUp(self):
        self.seq= list(range(10))
    @unittest.skip('跳过 01')
    def test_shuffle(self):
        random.shuffle(self.seq)
        self.seq.sort()
        self.assertEqual(self.seq,list(range(10)))
        self.assertRaises(TypeError,random.shuffle,(1,2,3))
        print(self.seq)
    @unittest.skipIf(a>5,'跳过02')
    def test_choice(self):
        element= random.choice(self.seq)
        self.assertTrue(element in self.seq)
        print(element)
    @unittest.skipUnless(sys.platform.startswith('linux'),'跳过3')
    def test_sample(self):
        with self.assertRaises(ValueError):
            random.sample(self.seq,20)
        for element in random.sample(self.seq,5):
            self.assertTrue(element in self.seq)

if __name__=='__main__':
    suite= unittest.TestLoader().loadTestsFromTestCase(TestquenceFunctioons)
    suite= unittest.TestSuite(suite)
    unittest.TextTestRunner(verbosity=2).run(suite)